package internal;

/**
 * 内部返回值
 *
 * @author wyl
 */
public class InternalResult {
    private boolean success;
    private boolean isException;
    private String errorMessage;
    private Object data;

    public InternalResult(boolean success, boolean isException, String errorMessage, Object data) {
        this.success = success;
        this.isException = isException;
        this.errorMessage = errorMessage;
        this.data = data;
    }

    public static InternalResult createSuccess() {
        return new InternalResult(true, false, null, null);
    }

    public static InternalResult crateError(String errorMessage, boolean isException) {
        return new InternalResult(false, isException, errorMessage, null);
    }

    public static InternalResult createSuccessResult(Object data) {
        return new InternalResult(true, false, null, data);
    }

    public boolean isSuccess() {
        return success;
    }

    public boolean isException() {
        return isException;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public Object getData() {
        return data;
    }


}
